

<style>
.layui-form-pane .layui-form-label{width:auto;}
.layui-form-item{margin-bottom: 0px;}

</style>
<div class="fixed-bar">
<form class="layui-form layui-form-pane fixed-bar-form" action="{:url()}" method="get" id="hisi-table-search">
<div class="layui-form-item">
    <div class="layui-inline">
        <label class="layui-form-label">来源帐号</label>
        <div class="layui-input-inline">
            {:Form::select('is_auto_import', '', [''=> '请选择']+config('mimo.order_from'), '', '')}
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">所属工厂</label>
        <div class="layui-input-inline">
          {:Form::select('factory_id', '', $factoryKV, '', '')}
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">创建日期</label>
        <div class="layui-input-inline time_input">
          <input type="text" name="create_date_range" readonly="" id="create_date_range" lay-verify="" placeholder="选择下单日期" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">订单号</label>
        <div class="layui-input-inline">
          <input type="text" name="client_ordernum" lay-verify="" placeholder="输入订单号" class="layui-input">
        </div>
    </div>
    {if env('env_site') == 'riwei' }
    <div class="layui-inline">
        <label class="layui-form-label">客户单号</label>
        <div class="layui-input-inline">
            <input type="text" name="ext_id" lay-verify="" placeholder="输入客户单号" class="layui-input">
        </div>
    </div>
    {/if}
    <div class="layui-inline">
        <label class="layui-form-label">超料原因</label>
        <div class="layui-input-inline">
          {:Form::select('overfeed_reason', '', ['' => '请选择', 1=>'纸样加大无法核价', 2=>'前面摆朴无法核价', 3=>'可以申请核价'], '', '')}
        </div>
    </div>
    
    <div class="layui-inline">
		<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">搜索</button>
        <button type="button" class="layui-btn layui-btn-primary hisi-export">导出</button>
		
	</div>
</div>
</form>
</div>

<table id="dataTable"></table>
{include file="system@block/layui" /}

<script type="text/html" id="ordernumTpl">
    <span class="copy-item">{{ d.client_ordernum }}</span>
</script>
<script type="text/html" id="skuTpl">
    <span class="copy-item">{{ d.sku }}</span>
</script>

<script type="text/html" id="subButtonTpl">
   <a href="javascript:void(0)" onclick="confirm({{ d.id }})" title="审核" data-order_material_id="{{ d.order_material_id }}" data-order_id="{{ d.order_id }}" class="layui-btn layui-btn-sm layui-btn-warm">审核</a>
</script>


<script type="text/html" title="" id="cOrderNumTpl">
            <a href="{:url('task')}?client_ordernum={{d.client_ordernum}}&alert=1" class="hisi-iframe" title="订单详情" hisi-data="{width: '80%', height: '80%'}">{{d.client_ordernum}}</a>
    </script>
<script type="text/javascript">

    layui.use(['opTable','table', 'jquery', 'tool', 'laydate', 'layer', 'form', 'laytpl'], function() {
        var $ = layui.jquery;
        var table = layui.table;
        var laydate = layui.laydate;
        var layer = layui.layer;
        var laytpl = layui.laytpl;
        //数据统计弹窗操作start
        var where=where1="";
        var hreStr=window.location.search;
        
        table.render({
            elem : '#dataTable'
            ,url : '{:url()}'
            ,page: true
            ,limit: 20
            ,limits: [20,50,100,150,200]
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols : [[ 
                 {field:'is_auto_import_name',title : '账号',}
				 ,{field:'caichuang_user_name',title : '裁剪员',width:80}
                ,{field:'factory_name',title : '工厂',width:130}
                ,{field:'order_time',title : '下单时间',templet:function(d){return layui.util.toDateString(d.order_time * 1000);},width:180}//
                ,{field:'create_time',title : '创建时间',templet:function(d){return layui.util.toDateString(d.create_time * 1000);},width:180}
                ,{field:'client_ordernum',title : '订单号',templet:'#ordernumTpl',width:100}
                ,{field:'sku',title : 'sku', templet:'#skuTpl',width:180}
                ,{field:'name',title : '面料名称',templet:function(d){return d.mInfo.name},width:180}
                ,{field:'customer_dosage',title : '客户用量', }
                ,{field:'material_dosage',title : '实际用量'}
                ,{field:'overfeed_reason_detail',title : '超料原因',width:150}
                ,{field:'subbtn',title : '操作',templet:'#subButtonTpl',width:100}
            ]]
            ,openType : 1
			,done: function(res, curr, count){
				
			}
        });
        
        laydate.render({
            elem: '#create_date_range'
            ,range: '~'
            ,theme: 'molv'
            ,mark: {'{:$today}':''}
            ,change: function(value, date, endDate){
              $('#create_date_range').val(value);
            	$('#layui-laydate1').remove();//关闭面板
            }
        });
        // 审核确认
		window.confirm = function(id) {  
            $.ajax({
                type: "POST",
                url: "{:url('cutting/overfeedConfirm')}",
                data: "id="+id,
                dataType:"json",
                success: function(res){
                   if (res.code == 1) {
                       table.reload('dataTable');
                       layer.msg(res.msg, {icon: 1,anim: 6});
                   } else {
                      layer.msg(res.msg, {icon: 2,anim: 6});
                   }
                }
            });
        }
    });
</script>
